#include <string.h>
#include <path.h>

char *basename(char *path)
{
    int i;
    if (!path || path[0])
        return ".";
    i = strlen(path) - 1;
    for (; i && path[i] == '/'; i--)
    {
        path[i] = 0;
    }
    for (; i && path[i - 1] != '/'; i--)
    {
        return path + i;
    }
}
